package com.web.dao;

import com.web.entity.Notice;
import com.web.entity.TechRecruit;
import org.apache.ibatis.annotations.*;

public interface TechRecruitMapper {
    @Delete({
        "delete from APP_TECH_RECRIITMENT",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into APP_TECH_RECRIITMENT (user_id, post, ",
        "recruitment_type, duration, ",
        "work_year, min_salary, ",
        "max_salary, address, ",
        "latitude, longitude, ",
        "edu_id, contact, ",
        "contact_information, create_time, ",
        "modify_time, share_num, ",
        "is_invalid, is_topping, ",
        "is_review, post_info, ",
        "create_by, modify_by)",
        "values (#{userId,jdbcType=VARCHAR}, #{post,jdbcType=VARCHAR}, ",
        "#{recruitmentType,jdbcType=INTEGER}, #{duration,jdbcType=INTEGER}, ",
        "#{workYear,jdbcType=DOUBLE}, #{minSalary,jdbcType=DOUBLE}, ",
        "#{maxSalary,jdbcType=DOUBLE}, #{address,jdbcType=VARCHAR}, ",
        "#{latitude,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, ",
        "#{eduId,jdbcType=INTEGER}, #{contact,jdbcType=VARCHAR}, ",
        "#{contactInformation,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{modifyTime,jdbcType=TIMESTAMP}, #{shareNum,jdbcType=INTEGER}, ",
        "#{isInvalid,jdbcType=INTEGER}, #{isTopping,jdbcType=INTEGER}, ",
        "#{isReview,jdbcType=VARCHAR}, #{postInfo,jdbcType=VARCHAR}, ",
        "#{createBy,jdbcType=VARCHAR}, #{modifyBy,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(TechRecruit record);

    int insertSelective(TechRecruit record);

    @Select({
        "select",
        "id, user_id, post, recruitment_type, duration, work_year, min_salary, max_salary, ",
        "address, latitude, longitude, edu_id, contact, contact_information, create_time, ",
        "modify_time, share_num, is_invalid, is_topping, is_review, post_info, create_by, ",
        "modify_by",
        "from APP_TECH_RECRIITMENT",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    TechRecruit selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TechRecruit record);

    @Update({
        "update APP_TECH_RECRIITMENT",
        "set user_id = #{userId,jdbcType=VARCHAR},",
          "post = #{post,jdbcType=VARCHAR},",
          "recruitment_type = #{recruitmentType,jdbcType=INTEGER},",
          "duration = #{duration,jdbcType=INTEGER},",
          "work_year = #{workYear,jdbcType=DOUBLE},",
          "min_salary = #{minSalary,jdbcType=DOUBLE},",
          "max_salary = #{maxSalary,jdbcType=DOUBLE},",
          "address = #{address,jdbcType=VARCHAR},",
          "latitude = #{latitude,jdbcType=VARCHAR},",
          "longitude = #{longitude,jdbcType=VARCHAR},",
          "edu_id = #{eduId,jdbcType=INTEGER},",
          "contact = #{contact,jdbcType=VARCHAR},",
          "contact_information = #{contactInformation,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "modify_time = #{modifyTime,jdbcType=TIMESTAMP},",
          "share_num = #{shareNum,jdbcType=INTEGER},",
          "is_invalid = #{isInvalid,jdbcType=INTEGER},",
          "is_topping = #{isTopping,jdbcType=INTEGER},",
          "is_review = #{isReview,jdbcType=VARCHAR},",
          "post_info = #{postInfo,jdbcType=VARCHAR},",
          "create_by = #{createBy,jdbcType=VARCHAR},",
          "modify_by = #{modifyBy,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TechRecruit record);

    TechRecruit getRecruit(Integer id);

}